package modul.pencatatan.datapeminjam;

import java.awt.Cursor;
import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import javax.swing.JOptionPane;
import model.util.conn.DataBaseConnection;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.view.JasperViewer;

public class formPeminjam extends javax.swing.JInternalFrame {

    public formPeminjam() {
        initComponents();
        this.setTitle("Peminjam");
        tabelModel = new PeminjamTabelModel();
        tbPeminjam.setModel(tabelModel);
        fillTabel();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        LabelFormPeminjam = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        tIdPeminjam = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        tNamaPeminjam = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        tTempatLahir = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jdcTanggalLahir = new com.toedter.calendar.JDateChooser();
        jLabel5 = new javax.swing.JLabel();
        cbJenisID = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        tNoID = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        tTelepon = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        tAlamat = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        tbPeminjam = new javax.swing.JTable();
        buttonTutup = new javax.swing.JButton();
        buttonTambah = new javax.swing.JButton();
        buttonUbah = new javax.swing.JButton();
        buttonCetakKartu = new javax.swing.JButton();
        buttonRefresh = new javax.swing.JButton();

        setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/modul/util/image/film_add.png"))); // NOI18N

        jPanel2.setBackground(new java.awt.Color(204, 255, 204));

        LabelFormPeminjam.setFont(new java.awt.Font("Tahoma", 1, 18));
        LabelFormPeminjam.setText("FORM DATA PEMINJAM");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(197, 197, 197)
                .addComponent(LabelFormPeminjam, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(243, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(LabelFormPeminjam)
                .addContainerGap(29, Short.MAX_VALUE))
        );

        jLabel1.setText("ID Peminjam");

        jLabel2.setText("Nama Peminjam");

        jLabel3.setText("Tempat Lahir");

        jLabel4.setText("Tanggal Lahir");

        jdcTanggalLahir.setDateFormatString("yyyy-MM-dd");

        jLabel5.setText("Jenis ID");

        cbJenisID.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "KTP", "SIM", "KTM" }));

        jLabel6.setText("No. ID");

        jLabel7.setText("Telepon");

        jLabel8.setText("Alamat");

        tbPeminjam.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tbPeminjam.getTableHeader().setReorderingAllowed(false);
        tbPeminjam.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbPeminjamMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tbPeminjam);

        buttonTutup.setText("Tutup");
        buttonTutup.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonTutupActionPerformed(evt);
            }
        });

        buttonTambah.setText("Tambah");
        buttonTambah.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonTambahActionPerformed(evt);
            }
        });

        buttonUbah.setText("Ubah");
        buttonUbah.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonUbahActionPerformed(evt);
            }
        });

        buttonCetakKartu.setText("Cetak Kartu Anggota");
        buttonCetakKartu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonCetakKartuActionPerformed(evt);
            }
        });

        buttonRefresh.setIcon(new javax.swing.ImageIcon(getClass().getResource("/modul/util/image/Button Refresh.png"))); // NOI18N
        buttonRefresh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonRefreshActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4))
                .addGap(26, 26, 26)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tIdPeminjam, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tNamaPeminjam, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tTempatLahir, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jdcTanggalLahir, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(68, 68, 68)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7)
                    .addComponent(jLabel8))
                .addGap(67, 67, 67)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(tNoID, javax.swing.GroupLayout.DEFAULT_SIZE, 201, Short.MAX_VALUE)
                    .addComponent(cbJenisID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tTelepon, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tAlamat))
                .addContainerGap(13, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 654, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(buttonRefresh)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 186, Short.MAX_VALUE)
                .addComponent(buttonCetakKartu)
                .addGap(18, 18, 18)
                .addComponent(buttonUbah, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(buttonTambah)
                .addGap(18, 18, 18)
                .addComponent(buttonTutup, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(tIdPeminjam, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(cbJenisID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(tNamaPeminjam, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(tNoID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(tTempatLahir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(tTelepon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel4)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8)
                            .addComponent(tAlamat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jdcTanggalLahir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonTutup)
                    .addComponent(buttonTambah)
                    .addComponent(buttonUbah)
                    .addComponent(buttonCetakKartu)
                    .addComponent(buttonRefresh))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void fillTabel() {
        try {
            int row = tbPeminjam.getRowCount();
            for (int i = 0; i < row; i++) {
                tabelModel.hapusTabel(0, row);
            }
            Statement st = DataBaseConnection.getConnection().createStatement();
            String sql = "select * from `peminjam` order by ID_Peminjam";
            ResultSet rs = st.executeQuery(sql);
            while (rs.next()) {
                Peminjam pj = new Peminjam();
                pj.setIdPeminjam(rs.getString(1));
                pj.setNamaPeminjam(rs.getString(2));
                pj.setTempatLahir(rs.getString(3));
                pj.setTglLahir(rs.getDate(4));
                pj.setJenisID(rs.getString(5));
                pj.setNoId(rs.getString(6));
                pj.setTelepon(rs.getString(7));
                pj.setAlamat(rs.getString(8));
                tabelModel.tambahDVDVCD(pj);
            }
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        } catch (OutOfMemoryError ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        }
    }

    private void setNullProperty() {
        tIdPeminjam.setText(null);
        tNamaPeminjam.setText(null);
        tTempatLahir.setText(null);
        jdcTanggalLahir.setDate(null);
        cbJenisID.setSelectedIndex(-1);
        tNoID.setText(null);
        tTelepon.setText(null);
        tAlamat.setText(null);
    }
private void buttonTutupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonTutupActionPerformed
    this.setVisible(false);
}//GEN-LAST:event_buttonTutupActionPerformed

private void buttonTambahActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonTambahActionPerformed
    if ((tIdPeminjam.getText().equals("")) || (tNamaPeminjam.getText().equals(""))
            || ((tTempatLahir.getText()).equals("")) || (jdcTanggalLahir.isValid())
            || ((tNoID.getText()).equals("")) || ((tTelepon.getText()).equals(""))
            || ((tAlamat.getText()).equals(""))) {
        JOptionPane.showMessageDialog(null, "Data Harus diisi lengkap...!");
    } else {
        try {
            SimpleDateFormat spdt = new SimpleDateFormat(jdcTanggalLahir.getDateFormatString());
            String dt = spdt.format(jdcTanggalLahir.getDate());
            String sql = "insert into peminjam () values (?,?,?,?,?,?,?,?);";
            PreparedStatement st = DataBaseConnection.getConnection().prepareStatement(sql);
            st.setString(1, (tIdPeminjam.getText()));
            st.setString(2, (tNamaPeminjam.getText()));
            st.setString(3, (tTempatLahir.getText()));
            st.setDate(4, java.sql.Date.valueOf(dt));
            st.setString(5, (cbJenisID.getSelectedItem().toString()));
            st.setString(6, (tNoID.getText()));
            st.setString(7, (tTelepon.getText()));
            st.setString(8, (tAlamat.getText()));
            st.executeUpdate();
            fillTabel();
            setNullProperty();
            JOptionPane.showMessageDialog(null, "Data berhasil ditambah");
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, ex, "Error", JOptionPane.ERROR_MESSAGE);
        }
    }
}//GEN-LAST:event_buttonTambahActionPerformed

private void tbPeminjamMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbPeminjamMouseClicked
    if (tbPeminjam.isEnabled()) {
        int n = 0;
        n = tbPeminjam.getSelectedRow();
        tIdPeminjam.setText(tbPeminjam.getValueAt(n, 0).toString());
        tNamaPeminjam.setText(tbPeminjam.getValueAt(n, 1).toString());
        tTempatLahir.setText(tbPeminjam.getValueAt(n, 2).toString());
        jdcTanggalLahir.setDate((Date) tbPeminjam.getValueAt(n, 3));
        cbJenisID.setSelectedItem(tbPeminjam.getValueAt(n, 4).toString());
        tNoID.setText(tbPeminjam.getValueAt(n, 5).toString());
        tTelepon.setText(tbPeminjam.getValueAt(n, 6).toString());
        tAlamat.setText(tbPeminjam.getValueAt(n, 7).toString());
    }
}//GEN-LAST:event_tbPeminjamMouseClicked

private void buttonUbahActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUbahActionPerformed
    if ((tIdPeminjam.getText().equals("")) || (tNamaPeminjam.getText().equals(""))
            || ((tTempatLahir.getText()).equals("")) || (jdcTanggalLahir.isValid())
            || ((tNoID.getText()).equals("")) || ((tTelepon.getText()).equals(""))
            || ((tAlamat.getText()).equals(""))) {
        JOptionPane.showMessageDialog(null, "Pilih data yang akan di ubah...!");
    } else {
        try {
            SimpleDateFormat spdt = new SimpleDateFormat(jdcTanggalLahir.getDateFormatString());
            String dt = spdt.format(jdcTanggalLahir.getDate());
            String sql = "update peminjam SET "
                    + "ID_Peminjam=?,"
                    + "Nama_peminjam=?,"
                    + "tempat_Lahir=?,"
                    + "tgl_Lahir=?,"
                    + "Jenis_ID=?,"
                    + "NO_ID=?,"
                    + "Telepon=?,"
                    + "Alamat=?"
                    + "where ID_Peminjam='" + tIdPeminjam.getText() + "';";
            PreparedStatement st = DataBaseConnection.getConnection().prepareStatement(sql);
            st.setString(1, (tIdPeminjam.getText()));
            st.setString(2, (tNamaPeminjam.getText()));
            st.setString(3, (tTempatLahir.getText()));
            st.setDate(4, java.sql.Date.valueOf(dt));
            st.setString(5, (cbJenisID.getSelectedItem().toString()));
            st.setString(6, (tNoID.getText()));
            st.setString(7, (tTelepon.getText()));
            st.setString(8, (tAlamat.getText()));
            st.executeUpdate();
            fillTabel();
            setNullProperty();
            JOptionPane.showMessageDialog(null, "Data berhasil diubah");
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, ex, "Error", JOptionPane.ERROR_MESSAGE);
        }
    }
}//GEN-LAST:event_buttonUbahActionPerformed

private void buttonCetakKartuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCetakKartuActionPerformed
    this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    if (tbPeminjam.isEnabled()) {
        int n = 0;
        n = tbPeminjam.getSelectedRow();
        if (n != -1) {
            JOptionPane.showMessageDialog(null, "Cetak kartu Anggota\n"
                    + tbPeminjam.getValueAt(n, 0).toString() + " " + tbPeminjam.getValueAt(n, 1).toString());
            Properties systemProp = System.getProperties();
            String currentDir = systemProp.getProperty("user.dir");
            File dir = new File(currentDir);
            String reportName = "KartuAnggota.jrxml";
            String coverName = "Cover.jpg";
            String coverBelakangName = "CoverBelakang.jpg";
            String reportDirName = "Report" + File.separatorChar + "Kartu Anggota";
            File fileRpt;
            File fileCover;
            File fileCoverBelakang;
            String fullPathReport = "";
            String fullPathCover = "";
            String fullPathCoverBelakang = "";
            if (dir.isDirectory()) {
                String[] isiDir = dir.list();
                for (int i = 0; i < isiDir.length; i++) {
                    fileRpt = new File(currentDir + File.separatorChar + reportDirName + File.separatorChar + reportName);
                    fileCover = new File(currentDir + File.separatorChar + reportDirName + File.separatorChar + coverName);
                    fileCoverBelakang = new File(currentDir + File.separatorChar + reportDirName + File.separatorChar + coverBelakangName);
                    if (fileRpt.isFile()) {
                        fullPathReport = fileRpt.toString();
                    }
                    if (fileCover.isFile()) {
                        fullPathCover = fileCover.toString();
                    }
                    if (fileCoverBelakang.isFile()) {
                        fullPathCoverBelakang = fileCoverBelakang.toString();
                    }
                }
            }
            try {
                Connection conn = DataBaseConnection.getConnection();
                JasperReport jasperReport = JasperCompileManager.compileReport(fullPathReport);
                Map params = new HashMap();
                params.put("PRM_KD_NO_ANGGOTA", tbPeminjam.getValueAt(n, 0).toString());
                params.put("PRM_KD_COVER", fullPathCover);
                params.put("PRM_KD_COVER_BELAKANG", fullPathCoverBelakang);
                JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, conn);
                JasperViewer.viewReport(jasperPrint, false);
            } catch (JRException ex) {
                JOptionPane.showMessageDialog(null, "Error...\n" + ex.getMessage());
            } catch (NoSuchMethodError ns) {
                JOptionPane.showMessageDialog(null, "Method Error...\n" + ns.getMessage());
            }
        }
    }
    this.setCursor(Cursor.getDefaultCursor());
}//GEN-LAST:event_buttonCetakKartuActionPerformed

private void buttonRefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRefreshActionPerformed
    fillTabel();
}//GEN-LAST:event_buttonRefreshActionPerformed
    private PeminjamTabelModel tabelModel;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel LabelFormPeminjam;
    private javax.swing.JButton buttonCetakKartu;
    private javax.swing.JButton buttonRefresh;
    private javax.swing.JButton buttonTambah;
    private javax.swing.JButton buttonTutup;
    private javax.swing.JButton buttonUbah;
    private javax.swing.JComboBox cbJenisID;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private com.toedter.calendar.JDateChooser jdcTanggalLahir;
    private javax.swing.JTextField tAlamat;
    private javax.swing.JTextField tIdPeminjam;
    private javax.swing.JTextField tNamaPeminjam;
    private javax.swing.JTextField tNoID;
    private javax.swing.JTextField tTelepon;
    private javax.swing.JTextField tTempatLahir;
    private javax.swing.JTable tbPeminjam;
    // End of variables declaration//GEN-END:variables
}
